package ying;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * ClassName: ServletDemo06
 * Package: ying
 * Description:
 *
 * @Author 刘英杰
 * @Create 2024/9/28 19:13
 * @Version 1.0
 */

/*避免get请求中误写post请求的代码,或post请求中误写get请求代码*/
@WebServlet("/demo06")
public class ServletDemo06 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //无论是GET请求还是POST请求都写在doGet中
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
